#define _CRT_SECURE_NO_WARNINGS 1
#include<string>
#include<stack>
#include<vector>
using namespace std;


class Solution {
public:
	int evalRPN(vector<string>& tokens)
	{
		stack<int> pushS;
		int i = 0;
		int return_num = 0;

		while (i<tokens.size())
		{
			if (tokens[i].size()>1 || (tokens[i][0] >= 48 && tokens[i][0] <= 57))
			{
				int push_num = std::stoi(tokens[i], nullptr);
				if (tokens.size() == 1)
					return return_num += push_num;
				pushS.push(push_num);
			}
			else
			{
				int Op = tokens[i][0] - 42;
				int right_op = pushS.top();
				pushS.pop();
				int left_op = pushS.top();
				pushS.pop();
				switch (Op)
				{
				case 0:
					return_num = left_op*right_op;
					break;
				case 1:
					return_num = left_op + right_op;
					break;
				case 3:
					return_num = left_op - right_op;
					break;
				case 5:
					return_num = left_op / right_op;
					break;
				}
				pushS.push(return_num);
			}
			i++;
		}
		return return_num;
	}
};